﻿Imports System.Data.OleDb

Public Class PagesNamesManagement
    Inherits ConnectionClass

    Public Sub InsertPageName(ByVal pageNameContent)
        Try

            myConnection.Open()
            Dim SqlString As String = "INSERT INTO PagesNames(PageNameContent) VALUES(@f1)"
            Dim newCmd As OleDbCommand = New OleDbCommand(SqlString, myConnection)
            newCmd.CommandType = CommandType.Text
            newCmd.Parameters.AddWithValue("@f1", pageNameContent)

            newCmd.ExecuteNonQuery()
            myConnection.Close()

        Catch ex As Exception

        End Try

    End Sub

    Public Function SelectPagesNamesByPageNameContent(ByVal pageNameContent As String) As OleDbDataReader

        Try

        
        myConnection.Open()
        Dim SqlString As String = "Select * From PagesNames Where PageNameContent=@f1"
        Dim cmd As OleDbCommand = New OleDbCommand(SqlString, myConnection)
        cmd.CommandType = CommandType.Text
        cmd.Parameters.AddWithValue("@f1", pageNameContent)
        Dim dr As OleDbDataReader = cmd.ExecuteReader()

        Return dr
        myConnection.Close()
        Catch ex As Exception
            Return Nothing
        End Try
    End Function

End Class
